package chapter07

/**
  * create by undeRdoG on  2021-06-05  21:51
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Test10_Tuple {

  def main(args: Array[String]): Unit = {
    val tuple: (String,Int,Char,Boolean) = ("hello",100,'a',false)
    println(tuple)

    // 访问数据
    tuple._4
    tuple._1

    // 根据索引位置获得，从0开始
    println(tuple.productElement(0))

    //遍历元组顺序
    for (elem <- tuple.productIterator){
      println(elem)
    }

    // 嵌套元组
    val mulTuple = (12,0,3,(23,"scala"),100)
    println(mulTuple._4._2)
  }
}
